/**
 * 
 */
package qy.jalgotrade.broker;

import java.time.ZonedDateTime;

/**
 * <pre>
 * Execution information for an order.
 * 
 * {@link OrderEvent#getEventInfo()}
 * </pre>
 * 
 * @author qy
 *
 */
public class OrderExecutionInfo {

	private double __price;

	private double __quantity;

	private double __commission;

	private ZonedDateTime __dateTime;

	private String __remark;

	/**
	 * 
	 * @param dateTime
	 */
	public OrderExecutionInfo(ZonedDateTime dateTime) {

		this(0.0, 0, 0.0, dateTime, "");
	}

	/**
	 * 
	 * @param dateTime
	 * @param remark
	 */
	public OrderExecutionInfo(ZonedDateTime dateTime, String remark) {

		this(0.0, 0, 0.0, dateTime, remark);
	}

	/**
	 * 
	 * @param price
	 * @param quantity
	 * @param commission
	 * @param dateTime
	 */
	public OrderExecutionInfo(double price, double quantity, double commission, ZonedDateTime dateTime) {

		this(price, quantity, commission, dateTime, "");
	}

	/**
	 * 
	 * @param price
	 * @param quantity
	 * @param commission
	 * @param dateTime
	 * @param remark
	 */
	public OrderExecutionInfo(double price, double quantity, double commission, ZonedDateTime dateTime, String remark) {

		__price = price;
		__quantity = quantity;
		__commission = commission;
		__dateTime = dateTime;
		__remark = remark;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {

		return String.format("%s - Price: %s - Amount: %s - Fee: %s (remark: %s)", __dateTime, __price, __quantity,
				__commission, __remark);
	}

	/**
	 * Returns the fill price.
	 * 
	 * @return
	 */
	public double getPrice() {

		return __price;
	}

	/**
	 * Returns the quantity.
	 * 
	 * @return
	 */
	public double getQuantity() {

		return __quantity;
	}

	/**
	 * Returns the commission applied.
	 * 
	 * @return
	 */
	public double getCommission() {

		return __commission;
	}

	/**
	 * Returns the :class:`datatime.datetime` when the order was executed.
	 * 
	 * @return
	 */
	public ZonedDateTime getDateTime() {

		return __dateTime;
	}
}
